import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/htmls/HelloWorld'
import Login from '@/htmls/Login'
import Main from '@/htmls/Main'
import AppList from '@/htmls/AppList'
import UserList from '@/htmls/UserList'
import First from '@/htmls/First'
import Blank from '@/components/Blank'
import AddApp from '@/htmls/AddApp'
import EditApp from '@/htmls/EditApp'
Vue.use(Router)

export default new Router({
    routes: [{
            path: '/',
            name: 'HelloWorld',
            component: HelloWorld
        },
        {
            path: '/login',
            name: 'Login',
            component: Login
        },
        {
            path: '/main',
            name: 'Main',
            meta: {
                // 添加该字段，表示进入这个路由是需要登录的
                requireAuth: false,
            },
            children: [{
                    path: '/first',
                    name: "first",
                    component: First
                },
                {
                    path: '/appList',
                    name: 'appList',
                    meta: {
                        requireAuth: false,
                    },
                    component: AppList,
                    children: [{
                        path: '/addApp',
                        name: "addApp",
                        component: AddApp

                    },
                    {
                      path: '/editApp',
                      name: "editApp",
                      component: EditApp

                  },{
                      path: '/',
                      name: 'blank',
                      component : Blank
                    }]
                },
                {
                    path: '/userList',
                    name: 'userList',
                    meta: {
                        requireAuth: false,
                    },
                    component: UserList
                }
            ],
            component: Main
        }
    ]
})